import hyRequest from '@/service/index'

enum Api {
  LOGIN_USER = '/village/sysUser/login',
  GET_Info = '/village/sysUser/getInfo',
  LOGOUT = '/village/sysUser/logout',
  REFRESH_TOKEN = '/village/sysUser/refreshToken',
  EDIT_INFO = '/village/sysUser/updateInfo'
}

// 登录请求
export const loginApi = (loginForm: any) => {
  return hyRequest.post({
    url: Api.LOGIN_USER,
    data: loginForm,
    isFormData: true
  })
}

// 查询用户信息
export const getInfo = () => {
  return hyRequest.post({
    url: Api.GET_Info
  })
}

// 注销
export const setLogout = () => {
  return hyRequest.post({
    url: Api.LOGOUT
  })
}

// 刷新token
export const refeshToken = () => {
  return hyRequest.post({
    url: Api.REFRESH_TOKEN
  })
}

// 编辑个人信息
export const EditInfo = (form: any) => {
  return hyRequest.post({
    url: Api.EDIT_INFO,
    data: form
  })
}
